{extend name='admin@public/content'}

{block name="content"}

<!-- 表单搜索 开始 -->
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}"  id="myform"  onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">订单地区</label>
        <div class="layui-input-inline">
            <select name="area" id="area" lay-verify="required" class="layui-input" style="display: block;">
                <option value="">查询地区</option>
                {foreach $areas as $area }
                <option value="{$area.id}" {if condition="$Think.get.area == $area.id"} selected="selected"{/if} >{$area.area_name}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">订单状态</label>
        <div class="layui-input-inline">
            <select name="pay_status"  id="pay_status" lay-verify="required" class="layui-input" style="display: block;">
                <option  id="all" >订单状态</option>
                {foreach name="orderPaystatus"  item="vo" key="k" }
                <option value="{$k}"  {if condition="($Think.get.pay_status === $k)"} selected="selected" {/if} >{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">订单时间</label>
        <div class="layui-input-inline">
            <input name="date" id='range-date' value="{$Think.get.date|default=''}" placeholder="请选择要查询的时间段" class="layui-input">
        </div>
    </div>

    

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">机器编号</label>
        <div class="layui-input-inline">
            <input name="machine_no" id="machine_no" value="{$Think.get.machine_no|default=''}" placeholder="请输入机器编号" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">卡号</label>
        <div class="layui-input-inline">
            <input name="card_no" id="card_no" value="{$Think.get.card_no|default=''}" placeholder="请输入卡编号" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">会员号</label>
        <div class="layui-input-inline">
            <input name="code" id="code" value="{$Think.get.code|default=''}" placeholder="请输入会员编号" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

    <div class="layui-form-item layui-inline">
        <input type="hidden" id="excel" name="excel" value="0" >
        <a class="layui-btn layui-btn-primary" style="background: gold;" id="export">导出表格</a>
    </div>

</form>
<script>
    window.laydate.render({range: true, elem: '#range-date'});
</script>
<!-- 表单搜索 结束 -->



<!--{empty name='list'}-->
<p class="help-block text-center well">没 有 记 录 哦！</p>
<!--{else}-->
<input type="hidden" value="resort" name="action">
<table class="layui-table" lay-skin="line">
    <thead>
    <tr>
        <th class='text-left nowrap'>订单编号</th>
        <th class='text-left nowrap'>机器编码</th>
        <th class='text-left nowrap'>卡编码</th>
        <th class='text-left nowrap'>机器地区</th>
        <th class='text-left nowrap'>具体位置</th>
        <th class='text-left nowrap'>工作方式</th>
        <th class='text-left nowrap'>订单金额</th>
        <th class='text-left nowrap'>订单状态</th>
        <th class='text-left nowrap'>订单编号</th>
        <th class='text-left nowrap'>订单时间</th>
        <th></th>
    </tr>
    </thead>
    <tbody>
    <!--{foreach $list as $key=>$vo}-->
    <tr>
        <td class="text-left nowrap">
            {$vo.id}
        </td>
        <td class='text-left nowrap'>
            {$vo.machine_no}
        </td>
        
        <td class='text-left nowrap'>
            {$vo.card_no}
        </td>
        <td class='text-left nowrap'>
            {$vo.area_name}
        </td>
        <td class='text-left nowrap'>
            {$vo.dormitory_num}
        </td>
        <td class='text-left nowrap'>
            <?php echo array_search($vo['wash_type'],$wash_type_array); ?>
        </td>
        <td class='text-left nowrap'>
            {$vo.amount|fenToyuan}
        </td>
        <td class='text-left nowrap'>
            {if $vo.pay_status == 0}已付款{/if}
            {if $vo.pay_status == 2}未付款{/if}
            {if $vo.pay_status == 1}付款失败{/if}
        </td>
        <td>{$vo.order_no}</td>
        <td>{$vo.update_at}</td>

        <td class='text-left nowrap'>
            {if auth("$classuri/edit") && $vo.pay_status == 0 }
                {if $vo.isback == 0}
                    <span class="text-explode">|</span>
                    <a data-title="编辑地区" data-modal='{:url("$classuri/edit")}?id={$vo.id}'>退款</a>

                    <a style="margin-left: 10px;" data-title="再洗一次" data-modal='{:url("$classuri/xiyici")}?id={$vo.id}'>再洗一次</a>
                {else}
                    <span class="text-explode">|</span>
                    <span>已退款</span>
                {/if}
            {/if}

            

        </td>
    </tr>
    <!--{/foreach}-->
    </tbody>
</table>
{if isset($page)}<p>{$page|raw}</p>{/if}
<!--{/empty}-->

<script type="text/javascript">
    $(function () {
       status = '{$Think.get.pay_status}';
       if(status !=='0' && status !=='1' && status !=='2'){
           $("#all").attr("selected",true);
       };

       $("#export").click(function () {
            $("#excel").val("1");
            var t = $('form').serializeArray();
            var tempArr = [];
            $.each(t, function() {
                tempArr.push(this.name + '=' + this.value);
            });
            var urlParamsStr = tempArr.join('&');
            var url=  $('form').attr("action")+"?"+urlParamsStr;
            window.open(url);  
            
       });

    });



</script>

{/block}